;#############################
;命令：
;nasm -f elf64 day9_0call_0sinx_1pro.asm -o main.o && gcc main.o -o main -lc -lm -no-pie && ./main
;输出：
;sin(0.523599) = 0.500000
;sin(1.570796) = 1.000000
;#############################
extern printf
extern sin

section .data
	;x1 = pi / 6 = 3.141592653589793 / 6
	x1: dq 0.523598775598299
	;x2 = pi / 2 = 3.141592653589793 / 2
	x2: dq 1.5707963267948965
	msg: db `sin(%f) = %f\n`, 0

section .text
	global main

main:
	push rbp
	mov rbp, rsp

;#############################
	movsd xmm0, [x1]
	mov eax, 1
	call sin

	mov rdi, msg
	movaps xmm1, xmm0
	movsd xmm0, [x1]
	mov eax, 2
	call printf

;#############################

;#############################
	movsd xmm0, [x2]
	mov eax, 1
	call sin

	mov rdi, msg
	movaps xmm1, xmm0
	movsd xmm0, [x2]
	mov eax, 2
	call printf

;#############################

	mov eax, 0
	leave
	ret
